Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes multiple changes to improve code readability, simplify function definitions, and update method calls across various files in the
brainstate
package. The most important changes include refactoring functions, cleaning up imports, and updating progress bar handling.close #44
Code readability improvements:
brainstate/compile/_loop_collect_return.py
: Refactored thescan
function to improve readability by formatting the parameters ofjax.lax.scan
across multiple lines.Function and method updates:
brainstate/compile/_make_jaxpr.py
: Refactored_init_state_trace
to_init_state_trace_stack
, including a new method_new_jax_trace
to handle different JAX versions, and updated calls to use the new method. [1] [2] [3]Import cleanup:
brainstate/compile/_make_jaxpr.py
: Removed an unused import ofnew_jax_trace
.brainstate/util/_tracers.py
: Removed thenew_jax_trace
function and its related import, as it is now defined elsewhere. [1] [2]Progress bar handling:
brainstate/compile/_progress_bar.py
: Simplified the progress bar update logic by introducing a new_tqdm
method and updating the__call__
method to usejax.debug.callback
.Example updates:
examples/100_hh_neuron_model.py
: Improved readability by formatting the parameters ofbst.compile.for_loop
across multiple lines.examples/106_COBA_HH_2007.py
: Removed an unused import ofdendritex
and updated the call tobst.nn.init_all_states
to exclude thedx.IonChannel
parameter. [1] [2]